import request from '@/config/axios'

// 教师信息 VO
export interface UsersVO {
  id: number // 用户ID
  username: string // 用户账号
  password: string // 密码
  nickname: string // 用户昵称
  remark: string // 备注
  deptId: number // 部门ID
  postIds: string // 岗位编号数组
  email: string // 用户邮箱
  mobile: string // 手机号码
  sex: number // 用户性别
  avatar: string // 头像地址
  status: number // 帐号状态
  loginIp: string // 最后登录IP
  loginDate: Date // 最后登录时间
  schoolCode: string // 所属园区
  birthDate: Date // 出生日期
  ethnicity: string // 民族
  education: string // 学历
  technicalTitle: string // 技术职称
  certificateType: string // 持证类别
  employmentStatus: string // 就职状态
  politicalStatus: string // 政治面貌
  homeAddress: string // 家庭地址
  idNumber: string // 身份证号
  leaveDate: Date // 离职时间
  leaveReason: string // 离职原因
  hireDate: Date // 入职时间
  retirementDate: Date // 退休日期
}

// 教师信息 API
export const UsersApi = {
  // 查询教师信息分页
  getUsersPage: async (params: any) => {
    return await request.get({ url: `/school/users/page`, params })
  },

  // 查询教师信息详情
  getUsers: async (id: number) => {
    return await request.get({ url: `/school/users/get?id=` + id })
  },

  // 新增教师信息
  createUsers: async (data: UsersVO) => {
    return await request.post({ url: `/school/users/create`, data })
  },

  // 修改教师信息
  updateUsers: async (data: UsersVO) => {
    return await request.put({ url: `/school/users/update`, data })
  },

  // 删除教师信息
  deleteUsers: async (id: number) => {
    return await request.delete({ url: `/school/users/delete?id=` + id })
  },

  // 导出教师信息 Excel
  exportUsers: async (params) => {
    return await request.download({ url: `/school/users/export-excel`, params })
  },

// ==================== 子表（教师证书） ====================

  // 获得教师证书分页
  getTeacherCertificatesPage: async (params) => {
    return await request.get({ url: `/school/users/teacher-certificates/page`, params })
  },
  // 新增教师证书
  createTeacherCertificates: async (data) => {
    return await request.post({ url: `/school/users/teacher-certificates/create`, data })
  },

  // 修改教师证书
  updateTeacherCertificates: async (data) => {
    return await request.put({ url: `/school/users/teacher-certificates/update`, data })
  },

  // 删除教师证书
  deleteTeacherCertificates: async (id: number) => {
    return await request.delete({ url: `/school/users/teacher-certificates/delete?id=` + id })
  },

  // 获得教师证书
  getTeacherCertificates: async (id: number) => {
    return await request.get({ url: `/school/users/teacher-certificates/get?id=` + id })
  },

// ==================== 子表（教师教育背景） ====================

  // 获得教师教育背景分页
  getTeacherEducationsPage: async (params) => {
    return await request.get({ url: `/school/users/teacher-educations/page`, params })
  },
  // 新增教师教育背景
  createTeacherEducations: async (data) => {
    return await request.post({ url: `/school/users/teacher-educations/create`, data })
  },

  // 修改教师教育背景
  updateTeacherEducations: async (data) => {
    return await request.put({ url: `/school/users/teacher-educations/update`, data })
  },

  // 删除教师教育背景
  deleteTeacherEducations: async (id: number) => {
    return await request.delete({ url: `/school/users/teacher-educations/delete?id=` + id })
  },

  // 获得教师教育背景
  getTeacherEducations: async (id: number) => {
    return await request.get({ url: `/school/users/teacher-educations/get?id=` + id })
  },

// ==================== 子表（教师工作调度） ====================

  // 获得教师工作调度分页
  getTeacherJobListPage: async (params) => {
    return await request.get({ url: `/school/users/teacher-job-list/page`, params })
  },
  // 新增教师工作调度
  createTeacherJobList: async (data) => {
    return await request.post({ url: `/school/users/teacher-job-list/create`, data })
  },

  // 修改教师工作调度
  updateTeacherJobList: async (data) => {
    return await request.put({ url: `/school/users/teacher-job-list/update`, data })
  },

  // 删除教师工作调度
  deleteTeacherJobList: async (id: number) => {
    return await request.delete({ url: `/school/users/teacher-job-list/delete?id=` + id })
  },

  // 获得教师工作调度
  getTeacherJobList: async (id: number) => {
    return await request.get({ url: `/school/users/teacher-job-list/get?id=` + id })
  },

// ==================== 子表（教师惩处） ====================

  // 获得教师惩处分页
  getTeacherPunishmentsPage: async (params) => {
    return await request.get({ url: `/school/users/teacher-punishments/page`, params })
  },
  // 新增教师惩处
  createTeacherPunishments: async (data) => {
    return await request.post({ url: `/school/users/teacher-punishments/create`, data })
  },

  // 修改教师惩处
  updateTeacherPunishments: async (data) => {
    return await request.put({ url: `/school/users/teacher-punishments/update`, data })
  },

  // 删除教师惩处
  deleteTeacherPunishments: async (id: number) => {
    return await request.delete({ url: `/school/users/teacher-punishments/delete?id=` + id })
  },

  // 获得教师惩处
  getTeacherPunishments: async (id: number) => {
    return await request.get({ url: `/school/users/teacher-punishments/get?id=` + id })
  },

// ==================== 子表（教师奖励） ====================

  // 获得教师奖励分页
  getTeacherRewardsPage: async (params) => {
    return await request.get({ url: `/school/users/teacher-rewards/page`, params })
  },
  // 新增教师奖励
  createTeacherRewards: async (data) => {
    return await request.post({ url: `/school/users/teacher-rewards/create`, data })
  },

  // 修改教师奖励
  updateTeacherRewards: async (data) => {
    return await request.put({ url: `/school/users/teacher-rewards/update`, data })
  },

  // 删除教师奖励
  deleteTeacherRewards: async (id: number) => {
    return await request.delete({ url: `/school/users/teacher-rewards/delete?id=` + id })
  },

  // 获得教师奖励
  getTeacherRewards: async (id: number) => {
    return await request.get({ url: `/school/users/teacher-rewards/get?id=` + id })
  },

// ==================== 子表（教师工作经历） ====================

  // 获得教师工作经历分页
  getTeacherWorkListPage: async (params) => {
    return await request.get({ url: `/school/users/teacher-work-list/page`, params })
  },
  // 新增教师工作经历
  createTeacherWorkList: async (data) => {
    return await request.post({ url: `/school/users/teacher-work-list/create`, data })
  },

  // 修改教师工作经历
  updateTeacherWorkList: async (data) => {
    return await request.put({ url: `/school/users/teacher-work-list/update`, data })
  },

  // 删除教师工作经历
  deleteTeacherWorkList: async (id: number) => {
    return await request.delete({ url: `/school/users/teacher-work-list/delete?id=` + id })
  },

  // 获得教师工作经历
  getTeacherWorkList: async (id: number) => {
    return await request.get({ url: `/school/users/teacher-work-list/get?id=` + id })
  },
}